<template>
  <div id="app">
<!--    <img alt="Vue logo" src="./assets/logo.png">-->
<!--    <router-view/>-->

    <el-table
      :data="tableData"
      style="width: 100%">
      <el-table-column
        prop="consumerId"
        label="用户编号"
        width="180">
      </el-table-column>
      <el-table-column
        prop="feedbackTime"
        label="用户投诉时间"
        width="180">
      </el-table-column>
      <el-table-column
        prop="feedbackComplaint"
        label="投诉内容">
      </el-table-column>
    </el-table>
    <el-input class="input" v-model="input" placeholder="请输入反馈"></el-input>
    <el-button type="danger" @click="submitFeedback">提交反馈</el-button>
  </div>

</template>

<script>
import service from "@/utils/http";

export default {
  name: 'Dialog',
  data () {
    return {
      feedbackInfo: '',
      input: '',
      tableData: [{
        consumerId: '1',
        feedbackTime: '2023-06-03',
        feedbackComplaint: '哈哈哈哈哈'
      }]
    }
  },
  methods: {
    submitFeedback () {
      let input = this.input
      console.log('提交；' + input)
      this.feedbackInfo.returnOpinion = input
      this.feedbackInfo.feedbackManagerTime = new Date().getDate()
      console.log(this.feedbackInfo)
      service.post('updateFeedback', {
        data: this.feedbackInfo
      })
        .catch(error => {
          console.log(error)
        })
        .then(res => {
          console.log(res.data)
          this.$router.push('/index/Complaint')
        })
    }
  },
  mounted () {
    // let feedbackInfo = localStorage.getItem('feedbackInfo')
    console.log(this.$route.query.feedbackInfo)
    let feedbackInfo = this.$route.query.feedbackInfo
    this.feedbackInfo = feedbackInfo
    this.tableData[0].consumerId = feedbackInfo.consumerId
    this.tableData[0].feedbackTime = feedbackInfo.feedbackTime
    this.tableData[0].feedbackComplaint = feedbackInfo.feedbackComplaint
  }
}
</script>

<style scoped>
.input {
  width: 500px;
  margin: 20px;
}
</style>
